Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable memory swapping on Linux servers #3381

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dtinth
Copy link
Contributor

@dtinth dtinth commented Sep 24, 2024

Short description of changes

Updated systemd unit file to disable swap on Jamulus process.

CHANGELOG: Server: Disabled swap memory usage on Linux.

Context: Fixes an issue?

I noticed that Jamulus server randomly (intermittently) become unresponsive for 0.3 – 1 seconds every once in a while. (This issue has happened for a long time prior.) This caused everyone to experience some sound drops (we call it "ตกหลุมอากาศ," an aviation term that refers to the experience of a cruising plane hitting an air pocket causing turbulence).

Last month I installed Netdata on my servers to collect detailed metrics. It seems that Linux has been paging some memory to/from disk every once in a while around the unresponsiveness occurs.

So systemd has the ability to prevent an app from using swap space. This might help with this issue. From my preliminary testing, it seems to have helped, albeit not completely.

As memory footprint of Jamulus server is very minimal (19.7M used after 8 months of uptime) I think this config change should not have any negative impact unless the server is run on a potato.

Does this change need documentation? What needs to be documented and how?

No.

Status of this Pull Request

Ready

What is missing until this pull request can be merged?

N/A

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@ann0see
Copy link
Member

ann0see commented Sep 24, 2024

Thanks. But why would the OS swap in the first place? The app is active and ram should be available for such a small footprint.

Maybe the server is running too much other stuff?

@ann0see ann0see added this to the Release 3.12.0 milestone Sep 24, 2024
@ann0see ann0see added the Linux Linux runtime issue label Sep 24, 2024
@dtinth
Copy link
Contributor Author

dtinth commented Sep 24, 2024

Yeah, the server runs other stuff too (such as a system that broadcasts MP3 streams, some web servers), so that’s a possible cause. I did cat /proc/<pid>/smaps before the change and some memory is indeed in the swap area.

The system I was running happens to have vm.swappiness = 60 (default value), so I think there is always a chance that the system moves the memory to swap area despite Jamulus having a low memory footprint and the system having plenty of free RAM.

@softins
Copy link
Member

softins commented Sep 26, 2024

I've added this change to my own servers, but I can't actually test properly until I'm back home after my holiday.

@pljones
Copy link
Collaborator

pljones commented Oct 12, 2024

Added to my servers and directories. I've a few other bits:

[Service]
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=20
IOSchedulingClass=realtime
IOSchedulingPriority=3
MemorySwapMax=0

No idea if the differences help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux Linux runtime issue
Projects
Status: Waiting on Team
Development

Successfully merging this pull request may close these issues.

4 participants